<?php
/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 2015/9/28
 * Time: 17:30
 */
include "conn.php";
$name = $school = $team = $time = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $name = test_input($_POST["name"]);
    $school = test_input($_POST["school"]);
    $team = test_input($_POST["team"]);
    $time = test_input($_POST["time"]);
}

function test_input($data)
{
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    return $data;
}

$sql = "INSERT INTO team (name, school,team,time) VALUES ('$name','$school','$team','$time')";
echo $sql;

if (!mysql_query($sql, $con)) {
    die('Error: ' . mysql_error());
}

mysql_close($con);
header("Location:index.php");
?>

